<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8" %>
<%@ taglib uri="http://shiro.apache.org/tags" prefix="shiro" %>
<!DOCTYPE html >
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>USER</title>
    <link rel="stylesheet" type="text/css"
          href="easyui/themes/bootstrap/easyui.css">
    <link rel="stylesheet" type="text/css" href="easyui/themes/icon.css">
    <script type="text/javascript" src="easyui/jquery.min.js"></script>
    <script type="text/javascript" src="easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="easyui/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript" src="myjs/path.js"></script>
    <script type="text/javascript" src='myjs/user.js'></script>
    <script src="js/yangshi.js"></script>

</head>
<body class="easyui-layout">
<shiro:lacksPermission name="user:look">没有查询此模块权限。。。</shiro:lacksPermission>
<shiro:hasPermission name="user:look">

    <table id='dg' class="easyui-datagrid" title="用户管理" style="width:100%;height:90%"
           data-options="rownumbers:true,singleSelect:true,method:'get',toolbar:'#tb'">
        <thead>
        <tr>

            <th data-options="field:'id',width:80,align:'center'" hidden="true">ID</th>
            <th data-options="field:'userName',width:220,align:'center'">登陆名</th>
            <th data-options="field:'nikeName',width:220,align:'center'">昵称</th>
            <th data-options="field:'jgName',width:120,align:'center'">隶属机构</th>
            <th data-options="field:'jgid',width:120,align:'center'" hidden="true">jgid</th>

        </tr>
        </thead>
    </table>
    <div id="tb" style="padding:5px;height:auto">
        <div style="margin-bottom:5px">
            <shiro:hasPermission name="user:update">
            <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="openWin()"
               id='xinzeng'>新增用户</a>
            </shiro:hasPermission>
            <shiro:hasPermission name="user:update">
            <a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="xopenWin()"
               id='xiu'>修改用户</a>
            </shiro:hasPermission>
            <shiro:hasPermission name="user:update">
            <a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="del()" id='del'>删除用户</a>
            </shiro:hasPermission>
            <shiro:hasPermission name="user:resetpw">
            <a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="rePsw()">密码重置</a>
            </shiro:hasPermission>
        </div>
        <div>
            <input id='tt3' class="easyui-combotree" style="width:160px;">
            <input class="easyui-searchbox" data-options="prompt:'请输入用户名',searcher:doSearch" style="width:200px"></input>

            <script>
                function doSearch(value) {
                    jid = $('#tt3').combotree('getValue')
                    key = value
                    $.ajax({
                        url: path+'/user/findAll.do',
                        data: {
                            jgid: $('#tt3').combotree('getValue'),
                            userName: value
                        },
                        dataType: 'json',
                        success: function (data) {
                            if (data.code == 0) {
                                $("#dg").datagrid('loadData', data.data);
                                $('#dg').datagrid('selectRow', 0);
                            } else {
                                alert('获得数据失败，请检查网络状况后重试!')
                            }
                        }
                    })
                }
            </script>
        </div>
    </div>
    <!--新增款型==============================================================================================================================-->
    <div style="margin: 20px 0;"></div>
    <div id="w" class="easyui-window" title='新增用户'
         data-options="modal:true,closed:true,iconCls:'icon-save',maximizable:false,minimizable:false,closable: false,collapsible:false"
         style="width: 610px; height: 200px; padding: 10px;" id="tan">
        <table cellpadding="4" width="570px" height: 200px;>
            <tr>
                <td>登录名:</td>
                <td>
                    <input id='username' class="easyui-validatebox" style="border-radius: 5px" type="text" name="name"
                           data-options="" onblur="userName()" width="130px">
                    <span id='username1' style="color:red;"> *</span>
                </td>
                <td>昵称:</td>
                <td>
                    <input id='nikename' class="easyui-validatebox" style="border-radius: 5px" type="text" name="name"
                           data-options="" width="130px">
                    <span id='nikename1' style="color:red;"> *</span>
                </td>
            </tr>
            <tr>
                <td>密码:</td>
                <td>
                    <input id="password1" style="border-radius: 5px" name="password" validType="length[6,32]"
                           invalidMessage='密码至少六位' class="easyui-validatebox" type="password" value="" width="130px"
                           onblur="password()"/>
                    <span id='ps' style="color:red;"> *</span>
                </td>
                <td>确认密码:</td>
                <td>
                    <input id='password2' type="password" name="repassword" style="border-radius: 5px"
                           class="easyui-validatebox" validType="equalTo['#password1']" invalidMessage="两次输入密码不匹配"
                           width="130px"/>
                    <span id='ps2' style="color:red;"> *</span>
                </td>
            </tr>
            <tr>
                <td>隶属机构:</td>
                <td>
                    <input id='tt2' class="easyui-combotree" style="width:165px;" onblur="jg()"><span id='jigou' style="color:red;"> *</span>
                </td>
                <td>角色分配:</td>
                <td>
                    <input id="cc" style="width: 165px;height: 30px" class="easyui-combobox"
                           name="language"
                           data-options="
					              valueField:'id',
					              textField:'note',
					              multiple:true,
					              multiline:true,
					              panelHeight:'auto'
			                       " editable="false">
                    <span id='role' style="color:red;"> *</span>
                </td>


            </tr>
            <tr>
                <td style="text-align: right;padding-right: 60px" colspan="4">
                    <button id="save" onclick="addUser()"
                            class="easyui-linkbutton" data-options="iconCls:'icon-save'">保存
                    </button>
                    <button id="no" onclick="closeWins()"
                            class="easyui-linkbutton" data-options="iconCls:'icon-no'">取消
                    </button>
                </td>
        </table>
    </div>

    <style scoped="scoped">
        .textbox {
            height: 20px;
            margin: 0;
            padding: 0 2px;
            box-sizing: content-box;
        }
    </style>
    </div>
    <!--修改===================================================================================================================================-->
    <div style="margin: 20px 0;"></div>
    <div id="xw" class="easyui-window" title='修改用户'
         data-options="modal:true,closed:true,iconCls:'icon-save',maximizable:false,minimizable:false,closable: false,collapsible:false" style="width: 290px; height: 200px; padding: 10px;" id="xtan">
        <table cellpadding="4">
            <tr>
                <td>昵称:</td>
                <td>
                    <input id='xnikename' class="easyui-validatebox" style="border-radius: 5px;width: 140px;" type="text" name="name"data-options="">
                    <span id='xnikename1' style="color:red;"> *</span>
                </td>
            </tr>
            <tr>
                <td>隶属机构:</td>
                <td>
                    <input id='xtt2' class="easyui-combotree" style="width:140px;">
                    <span id='xjigou' style="color:red;"> *</span>
                </td>
            </tr>
            <tr>
                <td>角色分配:</td>
                <td>
                    <input id="xcc"
                           style="width: 140px;height: 40px" class="easyui-combobox"
                           name="language"
                           data-options="
					              valueField:'id',
					              textField:'note',
					              multiple:true,
					              multiline:true,
					              panelHeight:'auto'
			                     "editable="false">
                    <span id='xrole' style="color:red;"> *</span>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;" colspan="2">
                    <button id="xsave" onclick="Update()" class="easyui-linkbutton" data-options="iconCls:'icon-save'">保存</button>
                    <button id="xno" onclick="xcloseWins()" class="easyui-linkbutton" data-options="iconCls:'icon-no'">取消 </button>
                </td>
            </tr>
        </table>
    </div>
    <style scoped="scoped">
        .textbox {
            height: 20px;
            margin: 0;
            padding: 0 2px;
            box-sizing: content-box;
        }
    </style>
    </div>
    <input id='jgid' value="<%=request.getParameter("jgid")%>" type='hidden'>
</shiro:hasPermission>
</body>
</html>